<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <h1>宠物列表</h1>
    <a href="./add.html">新增</a>
    <ul class="list"></ul>
    <!-- <form action="/api/v1/pets" method="post">
        <input type="text" name="name" placeholder="请输入名字">
        <input type="text" name="skills" placeholder="请输入技能">
        <input type="submit" placeholder="提交">
    </form> -->
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <script>
        $.ajax({
            type: "get",
            url: "/api/v1/pets",
            success: function (response) {
                var strHtml = "";
                response.forEach(item => strHtml += `<li>${item.name}</li>`);
                $('.list').html(strHtml);
            }
        });
    </script>
</body>

</html>